package data;

import java.sql.Connection;
import java.sql.DriverManager;

public class MysqlConnection {
	private static Connection connection;
	public final static String url="jdbc:mysql://localhost:5550/";
	public final static String dbname="boncyboutique";
	public final static String driver="com.mysql.jdbc.Driver";
	public final static String uname="root";
	public final static String upsswd="DL0onnf6z%";
	
	private MysqlConnection(){}
	
	public static Connection getConnection(){
		try{
			if(connection==null||connection.isClosed()){
				Class.forName(driver).newInstance();
				connection=DriverManager.getConnection(url+dbname,uname,upsswd);
			}
		}
		catch(Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return connection;
	}
}
